package com.itheima.manager;

import com.itheima.service.db.PmsProductService;
import com.itheima.util.R;
import com.itheima.vo.PageBeanVo;
import com.itheima.vo.PmsCreateProductVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

import java.util.List;


@Component
public class PmsProductManager {
    @DubboReference
    PmsProductService pmsProductService;


    public R findAllByPage(Integer brandId, String keyword, Integer pageNum, Integer pageSize, Integer productCategoryId, Integer productSn, Integer publishStatus, Integer verifyStatus) {
        PageBeanVo pageBeanVo = pmsProductService.findAllByPage(brandId, keyword, pageNum, pageSize, productCategoryId, productSn, publishStatus, verifyStatus);
        return R.success(pageBeanVo);
    }


    public void createProduct(PmsCreateProductVo pmsCreateProductVo) {
        pmsProductService.createProduct(pmsCreateProductVo);
    }

    public PmsCreateProductVo findProductInfoById(Integer id) {
       return  pmsProductService.findProductInfoById(id);
    }

    public void outProductByIds(List<Integer> ids, Integer publishStatus) {
        pmsProductService.outProductByIds(ids,publishStatus);

    }

    public void pushProductByIds(List<Integer> ids, Integer recommendStatus) {
        pmsProductService.pushProductByIds(ids,recommendStatus);
    }

    public void newProductByIds(List<Integer> ids, Integer newStatus) {
        pmsProductService.newProductByIds(ids,newStatus);
    }


    public void changeDeleteStatusProductByIds(List<Integer> ids, Integer deleteStatus) {
        pmsProductService.changeDeleteStatusProductByIds(ids,deleteStatus);
    }

    public void updateProduct(Integer id, PmsCreateProductVo pmsCreateProductVo) {
        pmsProductService.updateProduct(id,pmsCreateProductVo);
    }
}
